function Obj(o){
	return document.getElementById(o);
}
function say(text){
	alert(text);
}

function gourl(url){
window.location.href=url;
}

function echo(text){
document.write(text);
}
function key13(fun,value) {
	var $inp = $('input');
	$inp.bind('keydown', function (e) {
		var key = e.which;
		if (key == 13) {
		   fun(value);
		}
	});
}
function f5(){
window.location.reload();
}
function center(obj) { 
var screenWidth = $(window).width(), screenHeight = $(window).height();  
var scrolltop = $(document).scrollTop();
var objLeft = (screenWidth - obj.width())/2 ; 
var objTop = (screenHeight - obj.height())/2 + scrolltop; 
obj.css({left: objLeft + 'px', top: objTop + 'px','display': 'block'}); 
$(window).resize(function() { 
screenWidth = $(window).width(); 
screenHeight = $(window).height();
scrolltop = $(document).scrollTop(); 
objLeft = (screenWidth - obj.width())/2 ; 
objTop = (screenHeight - obj.height())/2 + scrolltop; 
obj.css({left: objLeft + 'px', top: objTop + 'px','display': 'block'}); 
}); 
$(window).scroll(function() { 
screenWidth = $(window).width(); 
screenHeight = $(window).height(); 
scrolltop = $(document).scrollTop(); 
objLeft = (screenWidth - obj.width())/2 ; 
objTop = (screenHeight - obj.height())/2 + scrolltop; 
obj.css({left: objLeft + 'px', top: objTop + 'px','display': 'block'}); 
}); 
} 
function un_center(obj) { 
	obj.css('display', 'none'); 
	 
	$(window).resize(function(){
		obj.css('display', 'none');
	}); 
	$(window).scroll(function(){
		obj.css('display', 'none');
	}); 
} 
function c_right(obj) { 
var screenWidth = $(window).width(), screenHeight = $(window).height();  
var scrolltop = $(document).scrollTop(); 
var objTop = (screenHeight - obj.height())/2 + scrolltop; 
obj.css({top: objTop + 'px','display': 'block'}); 
 
$(window).resize(function() { 
screenWidth = $(window).width(); 
screenHeight = $(window).height();
scrolltop = $(document).scrollTop(); 
objTop = (screenHeight - obj.height())/2 + scrolltop; 
obj.css({top: objTop + 'px','display': 'block'}); 
}); 
$(window).scroll(function() { 
screenWidth = $(window).width(); 
screenHeight = $(window).height(); 
scrolltop = $(document).scrollTop(); 
objTop = (screenHeight - obj.height())/2 + scrolltop; 
obj.css({top: objTop + 'px','display': 'block'}); 
}); 
} 

function graybg(obj){
	h=$(document.body).height();
	obj.height(h);
	obj.css("display","block");
}
function un_graybg(obj){
	obj.css("display","none");
}

function xmlhttprequest(){
	if(window.ActiveXObject){
		xmlHttp = new ActiveXObject('Microsoft.XMLHTTP');
	}
	else if(window.XMLHttpRequest){
		xmlHttp = new XMLHttpRequest();
	}
	else{
		say('Your browser does not support the Ajax technology!');
	}
}

function show_window(div,para){
	hidden_window();
	graybg($("#graybg"))
	var file='window.php?div='+div+'&'+para+'&a='+Math.random();
    xmlhttprequest();
	xmlHttp.open("GET", file, true);
	xmlHttp.onreadystatechange =function(){
		if(xmlHttp.readyState == 1){
			center($("#list_load"));
		}
		if(xmlHttp.readyState == 4 && xmlHttp.status == 200){
			q=xmlHttp.responseText.replace(/^\s*|\s*$/g,"");
			un_center($("#list_load"));
			$("#window_content").css("display","block");
			$("#window_content").html(q);
			center($('#'+div+'_window'));
		}
	}
	xmlHttp.send(null);	
}

function add_window(div,del_div,para){
	del_window(del_div);
	graybg($("#graybga"))
	var file='window.php?div='+div+'&'+para+'&a='+Math.random();
    xmlhttprequest();
	xmlHttp.open("GET", file, true);
	xmlHttp.onreadystatechange =function(){
		if(xmlHttp.readyState == 1){
			center($("#list_load"));
		}
		if(xmlHttp.readyState == 4 && xmlHttp.status == 200){
			q=xmlHttp.responseText.replace(/^\s*|\s*$/g,"");
			un_center($("#list_load"));
			$("#window_content").append(q);
			center($('#'+div+'_window'));
		}
	}
	xmlHttp.send(null);	
}

function del_window(div){
	$('#graybga').css("display","none");
	$('#'+div+'_window').remove();
}

function hidden_window(){
	$('#graybg' ).css("display","none");
	$('#graybga' ).css("display","none");
	$('#window_content' ).css("display","none");
}

function checkall(selected){
	var obj = document.form;
	for(var i = 0; i < obj.elements.length; i++){
		var s = obj.elements[i]; 
		if((s.id).indexOf('checkid') != -1){
			s.checked = selected;
		}
	}
}
function mgr_delall(submiturl){
	document.form.action = submiturl+'?action=delall';
	document.form.submit();
}